package com.oracle.violet.first.until

import com.mchange.v2.c3p0.ComboPooledDataSource

/** c3p0连接池
  * author: old sheep
  * QQ: 64341393 
  * Created 2018/10/10
  */
object C3P0Pools {

    private lazy val dataSource = new ComboPooledDataSource()
    dataSource.setDriverClass("com.mysql.jdbc.Driver")
    dataSource.setJdbcUrl("jdbc:mysql:///socct?characterEncoding=utf-8")
    dataSource.setUser("root")
    dataSource.setPassword("root")


    def getConnection = {
        dataSource.getConnection
    }

    // 返回一个连接池
    def getDataSource =  dataSource


}
